package lab5;

/**
 * A simple test system for the class TrafficSignal.
 */
public class Test {
  
  /**
   * Run a TrafficSignalTest.
   */
  public static void main (String[] argv) {
    TrafficSignalTest test;
    test = new TrafficSignalTest();
    test.runTest();
  }
}

/**
 * A tester for the class TrafficSignal.
 */
class TrafficSignalTest {
  
  private TrafficSignal signal;      // the object to test
  
  /**
   * Create a TrafficSignalTest
   */
  public TrafficSignalTest () {
    // create a signal to test:
    signal = new TrafficSignal();
  }
  
  /**
   * Run the test.
   */
  public void runTest () {
    testInitialState();
    testChange();
  }
  
  /**
   * Test the TrafficSignal's initial state.
   */
  private void testInitialState () {
    System.out.println("testInitialState:");
    System.out.println("Initial light: " + signal.light());
  }
  
  /**
   * Test the method change.
   */
  private void testChange () {
    System.out.println("testChange:");
    System.out.println("Starting light: " + signal.light());
    signal.change();
    System.out.println("After 1 change: " + signal.light());
    signal.change();
    System.out.println("After 2 changes: " + signal.light());
    signal.change();
    System.out.println("After 3 changes: " + signal.light());
  }
}